//
//  TYRecorderTool.h
//  VoiceMemoDemo
//
//  Created by Maty on 2018/8/1.
//  Copyright © 2018年 kangarootec. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "TYLevelPairs.h"

typedef void(^TYRecordingStopCompletionHandler)(BOOL);
typedef void(^TYRecordingSaveCompletionHandler)(BOOL, id);
typedef void(^TYAudioPlayerStopPlayingCompletionHandler)(BOOL);

@class TYMemo;

@protocol THRecorderControllerDelegate <NSObject>
- (void)interruptionBegan;
@end

@interface TYRecorderTool : NSObject

//+ (instancetype)shareInstance;
- (id)init:(NSDictionary *)config;

@property (nonatomic, copy, readonly) NSString *formattedCurrentTime;
@property (nonatomic, assign, readonly) NSInteger getCurrentTime;
@property (nonatomic, copy) TYAudioPlayerStopPlayingCompletionHandler audioPlayerStopPlayingCompletionHandler;
@property (nonatomic, weak) id <THRecorderControllerDelegate>delegate;


- (void)customInit;
- (BOOL)record;
- (void)pause;

- (void)stopWithCompletionHandler:(TYRecordingStopCompletionHandler)handler;

- (BOOL)playbackMemo:(TYMemo *)memo;
- (void)audioPlayerStopPlaying:(TYAudioPlayerStopPlayingCompletionHandler)stopPlayingHandler;

- (TYLevelPairs *)levels;
- (CGFloat)getAveragePower;

@end
